home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
msctsr.arc
/
POPUP.C
next >
Wrap
C/C++ Source or Header
|
1987-05-26
|
2KB
|
63 lines
/* popup.c - Short demonstration of how to write "pop-up" utilities using
* Microsoft C version 4.0. Link this program with the object file of
* tsr.asm (also included in this ARC).
*
* The code in tsr.asm, written by Thomas Brandenborg of Denmark, is a
* very good example of how to write memory-resident "pop-up" utilities.
* It was adapted for use with Microsoft C 4.0 by myself, Paul Ketrick.
* I haven't had time to write a good demo of this library's capabilities
* (obviously), but it all does seem to work very well. However, if you
* have any problems with this code or find any bugs in it, I would
* appreciate your leaving me a short message about it on either the
* Programmer's Forum at (818)701-1021 or Mike's C BBS at (619)722-8724.
* You may use this code in any way you see fit, but please give me credit
* for it in your source code (and the object too, if you want). Also see
* Mr. Brandenborg's copyright notice in the other file.
*/
#include <stdio.h>
#include <ctype.h>
main()
{
printf("Installing Pop-up TSR code...\n");
init(); /* Call a/l routine to install */
/* memory-resident pop-up utility */
/* (does not return to caller) */
}
/* popup() is called by the code in tsr.asm which intercepts keyboard
* interrupts and watches for the "hot key." It may safely use any DOS
* functions including console I/O, file I/O, etc. and may use any C
* library functions EXCEPT dynamic memory allocation in the default (near)
* data segment. In order to use these functions, a small change must be
* made to tsr.asm - see process _Init in that file for more information.
*/
popup()
{
int i;
for (;;) {
printf("\nPop-Up Program:\n");
printf("A - ASCII table\n");
printf("N - Notepad\n");
printf("X - Exit.\n");
i = getchar();
switch(toupper(i)) {
case 'A':
printf("Sorry, ASCII table unavailable.\n");
break;
case 'N':
printf("Sorry, notepad unavailable.\n");
break;
case 'X':
printf("Exiting Pop-up.\n");
return;
}
}
}